Skip to content

Embed the errcheck analyzer - #35

Merged
nnutter merged 2 commits into
masterfrom
analysis-laser-powerwall
Nov 5, 2026
Merged

nnutter merged 2 commits into
masterfrom
analysis-laser-powerwall

Conversation

@nnutter

@nnutter nnutter commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

No description provided.

constable does not report a diagnostic in a file that carries the
generated-code comment, because the next run of the generator overwrites
the file. An analyzer that constable embeds from another module knows
nothing about that rule.

Wrap the analyzer and drop a diagnostic whose position is in a generated
file. The wrapper copies the pass so the analyzer keeps the original
report function for the files that matter, and the upstream analyzer
needs no change.

Change-Id: Ice29ad33714bae6921da778bb0c5577d296d5b94
A repository that installs errcheck, sumtype, nilaway, and the rest runs
a binary for each, with its own command line, exit code, and rules about
which files to report. constable already runs analyzers that another
module publishes as a go/analysis analyzer, so these checks can share
one command line and one policy.

errcheck reports an error that the code discards. The upstream analyzer
needs no other analyzer, so the adapter only applies the generated-file
rule.

The test drives the adapter with analysistest. Its testdata holds an
unchecked error in a normal file and one in a generated file, so the
test proves both that the analyzer reports and that the wrapper drops
the report that constable must not print.

Change-Id: I34d6b21c76ae62a5ff346fede72513c5b3744760
@nnutter
nnutter added this pull request to stack #41 November 5, 2026 07:46
@nnutter nnutter changed the title analysis laser powerwall Embed the errcheck analyzer Nov 5, 2026
@nnutter
nnutter merged commit 30a547d into master Nov 5, 2026
3 checks passed
@nnutter
nnutter deleted the analysis-laser-powerwall branch November 5, 2026 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant